/**
 * Created by JF-Z on 2017/12/7.
 */
angular.module('service.devup', ['ngResource'])

    .service('DevupService', ['$resource', function ($resource) {
        //设备升级表接口
        this.updatedev = function(updateinfo,succ_fun,err_fun){
            var resource = $resource(wmdev_versionUrl + "devup");
            return resource.save({},updateinfo,succ_fun,err_fun);
        };
        //设备日志列表
        this.getDevNote=function () {
            var resource = $resource(dev_url + "devup");
            return resource.query();
        }
        //调用商店列表
        this.getShop = function(){
            var resource = $resource(shop_url + "shopinfo");
            return resource.query();
        };
          //通过shopid调用devid
        this.getDev = function(shopid,success,error){
            var resource = $resource(shop_url + "shodev/byshopid/:shopid");
            return resource.query({shopid:shopid},success,error);
        }
        //通过devid调用设备列表
        this.getVer = function(devid,success,error){
            var resource = $resource(dev_url + "devbase/:devid");
            return resource.get({devid:devid},success,error);
        }
        // 根据地区查询店铺
        this.getShopByAddr = function(address){
            var resource = $resource(shop_url + "shopinfo/shopaddress/:address");
            return resource.query({address: address});
        }
        //传递获取升级版本
        this.getVerUp=function(info,success,error){
            var resourse=$resource(dev_url+"devup/harsofa", {}, {
                save: {
                    method: "POST",
                    isArray: true
                }
            });
            return resourse.save({},info,success,error);
        };
        //升级设备
        this.getDevUp=function (devup,success,error) {
            var resourse=$resource(dev_url+"sendup/sendups");
            return resourse.save({},devup,success,error);

        }

    }])